package com.csgc.camera.storage

import com.csgc.camera.storage.base.BasePreferences


class CommonPreference private constructor(preferenceID:String): BasePreferences(preferenceID ) {

    companion object{

        //隐私协议
        private const val KEY_AGREE_PRIVACY = "agreePrivacy"

        //功能弹框时间&类型
        private const val KEY_GUIDE_TIME = "guide_time"
        private const val KEY_GUIDE_TYPE = "guide_type"

        //是否显示过引导页
        private const val KEY_SHOW_GUIDE_PAGE = "show_guide_page"

        //选择行业
        private const val KEY_CHOOSE_MASK_TYPE = "choose_mask_type"

        val instance by lazy(LazyThreadSafetyMode.NONE){
            CommonPreference("common")
        }
    }

    fun setAgreePrivacy(){
        this.setBoolean(KEY_AGREE_PRIVACY,true)
    }
    fun isAgreePrivacy():Boolean{
       return this.getBoolean(KEY_AGREE_PRIVACY,false)?:false
    }


    fun setGuideTime(time:Long){
        this.setLong(KEY_GUIDE_TIME,time)
    }
    fun getGuideTime():Long{
        return getLong(KEY_GUIDE_TIME,0)?:0
    }


    fun setGuideType(type:Int){
        setInt(KEY_GUIDE_TYPE,type)
    }

    fun getGuideType():Int{
        return getInt(KEY_GUIDE_TYPE,0)?:0
    }

    fun setGuidePage(show:Boolean){
        this.setBoolean(KEY_SHOW_GUIDE_PAGE,show)
    }
    fun isShowGuidePage():Boolean{
        return getBoolean(KEY_SHOW_GUIDE_PAGE,false)?:false
    }


    fun setFirstChooseMask(show:Boolean){
        setBoolean(KEY_CHOOSE_MASK_TYPE,show)
    }
    fun isShowChooseMask():Boolean{
        return getBoolean(KEY_CHOOSE_MASK_TYPE,false)?:false
    }
}